<!doctype html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="chrisrc, christtrc, 前端, 后端, 系统架构, 微服务, Microservice, 容器, Docker, DC/OS, DCOS, Mesos, Marathon, Marathon-LB, HAProxy, VIPs, Rex-Ray, GlusterFS, Ceph, Prometheus, DevOps, Jenkins, IT自动化, 大数据, Storm, Spark, Akka, Cassandra, 互联网金融, 互联网彩票, 互联网, 移动互联网, 物联网, 博客, 个人网站, Hexo, NexT" />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta property="og:type" content="website">
<meta property="og:title" content="山中，山外与俯瞰">
<meta property="og:url" content="http://chrisrc.me/page/5/index.html">
<meta property="og:site_name" content="山中，山外与俯瞰">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="山中，山外与俯瞰">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    sidebar: {"position":"left","display":"post"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://chrisrc.me/page/5/"/>





  <title> 山中，山外与俯瞰 </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  










  
  
    
  

  <div class="container one-collumn sidebar-position-left 
   page-home 
 ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta ">
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">山中，山外与俯瞰</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle">一次永不停止的探索之旅</p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-dcos">
          <a href="/dcos" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-book"></i> <br />
            
            DC/OS
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="st-search-show-outputs">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <form class="site-search-form">
  <input type="text" id="st-search-input" class="st-search-input st-default-search-input" />
</form>

<script type="text/javascript">
  (function(w,d,t,u,n,s,e){w['SwiftypeObject']=n;w[n]=w[n]||function(){
    (w[n].q=w[n].q||[]).push(arguments);};s=d.createElement(t);
    e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e);
  })(window,document,'script','//s.swiftypecdn.com/install/v2/st.js','_st');

  _st('install', 'R9GcmhBwxpsAGLNCsquZ','2.0.0');
</script>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            
  <section id="posts" class="posts-expand">
    
      

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
  <link itemprop="mainEntityOfPage" href="http://chrisrc.me/2015/09/09/ruby-on-rails-learning-notes/">

  <span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="chrisrc">
    <meta itemprop="description" content="">
    <meta itemprop="image" content="/images/avatar.gif">
  </span>

  <span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="山中，山外与俯瞰">
    <span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
      <img style="display:none;" itemprop="url image" alt="山中，山外与俯瞰" src="">
    </span>
  </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                
                <a class="post-title-link" href="/2015/09/09/ruby-on-rails-learning-notes/" itemprop="url">
                  Ruby on Rails 4 入门
                </a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2015-09-09T14:06:21+08:00">
                2015-09-09
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Ruby/" itemprop="url" rel="index">
                    <span itemprop="name">Ruby</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <a href="/2015/09/09/ruby-on-rails-learning-notes/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2015/09/09/ruby-on-rails-learning-notes/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          

          
          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        
          <h2 id="开始了解RoR"><a href="#开始了解RoR" class="headerlink" title="开始了解RoR"></a>开始了解RoR</h2><p>开始RoR之前，总想着有一个<br>舒服的IDE环境，现在主流的就是Rubymine了，只是习惯了Netbeans对Maven项目的无侵入性，打开pom.xml就能识别工程，看到IDEA的.iml 和 .idea，<br>Eclipse的.project 和 .classpath甚至.settings，对IDE也越来越不感冒。</p>
<p>在准备实际动手之前，先简单学习了一下ruby的语法，相比其他语言，基础语法规则确实简单不少。</p>
          <!--noindex-->
          <div class="post-more-link text-center">
            <a class="btn" href="/2015/09/09/ruby-on-rails-learning-notes/#more" rel="contents">
              阅读全文 &raquo;
            </a>
          </div>
          <!--/noindex-->
        
      
    </div>

    <div>
      
    </div>

    <div>
      
    </div>


    <footer class="post-footer">
      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
  <link itemprop="mainEntityOfPage" href="http://chrisrc.me/2015/09/06/linux-broadcom-driver-for-kernel-4/">

  <span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="chrisrc">
    <meta itemprop="description" content="">
    <meta itemprop="image" content="/images/avatar.gif">
  </span>

  <span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="山中，山外与俯瞰">
    <span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
      <img style="display:none;" itemprop="url image" alt="山中，山外与俯瞰" src="">
    </span>
  </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                
                <a class="post-title-link" href="/2015/09/06/linux-broadcom-driver-for-kernel-4/" itemprop="url">
                  Broadcom Wireless Driver for Linux Kernel 4.0
                </a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2015-09-06T20:36:27+08:00">
                2015-09-06
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Linux/" itemprop="url" rel="index">
                    <span itemprop="name">Linux</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <a href="/2015/09/06/linux-broadcom-driver-for-kernel-4/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2015/09/06/linux-broadcom-driver-for-kernel-4/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          

          
          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        
          <p>看到网上有大量介绍KDE5.x版本的软文，也想体验一下最新的产品，一番选择和对比，在Kubuntu15.10和openSUSE42.1之间，选择了<br>后者（我的工作环境是基于Ubuntu的 <strong>Deepin 2014.3</strong>）。</p>
          <!--noindex-->
          <div class="post-more-link text-center">
            <a class="btn" href="/2015/09/06/linux-broadcom-driver-for-kernel-4/#more" rel="contents">
              阅读全文 &raquo;
            </a>
          </div>
          <!--/noindex-->
        
      
    </div>

    <div>
      
    </div>

    <div>
      
    </div>


    <footer class="post-footer">
      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
  <link itemprop="mainEntityOfPage" href="http://chrisrc.me/2015/09/02/autoit-sonarqube-eclipse/">

  <span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="chrisrc">
    <meta itemprop="description" content="">
    <meta itemprop="image" content="/images/avatar.gif">
  </span>

  <span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="山中，山外与俯瞰">
    <span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
      <img style="display:none;" itemprop="url image" alt="山中，山外与俯瞰" src="">
    </span>
  </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                
                <a class="post-title-link" href="/2015/09/02/autoit-sonarqube-eclipse/" itemprop="url">
                  代码审查工具SonarQube与Eclipse集成
                </a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2015-09-02T09:41:27+08:00">
                2015-09-02
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/IT自动化/" itemprop="url" rel="index">
                    <span itemprop="name">IT自动化</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <a href="/2015/09/02/autoit-sonarqube-eclipse/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2015/09/02/autoit-sonarqube-eclipse/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          

          
          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        
          <div class="toc"></div>

<h2 id="插件兼容列表"><a href="#插件兼容列表" class="headerlink" title="插件兼容列表"></a>插件兼容列表</h2><table>
<thead>
<tr>
<th style="text-align:left">plugin</th>
<th style="text-align:left">3.4</th>
<th style="text-align:left">3.5</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left"></td>
</tr>
</tbody>
</table>
<p>SonarQube|3.6+|4.2+<br>Eclipse|3.7.x, 3.8.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x (Indigo, Juno, Kepler, Luna, Mars)|4.2.x, 4.3.x, 4.4.x, 4.5.x(Juno, Kepler, Luna, Mars)<br>Supported Plugins / Languages|Java, C/C++(only C++ is supported), Python| <a href="http://docs.sonarqube.org/display/SONAR/Features+details">Feature Details</a>  </p>
          <!--noindex-->
          <div class="post-more-link text-center">
            <a class="btn" href="/2015/09/02/autoit-sonarqube-eclipse/#more" rel="contents">
              阅读全文 &raquo;
            </a>
          </div>
          <!--/noindex-->
        
      
    </div>

    <div>
      
    </div>

    <div>
      
    </div>


    <footer class="post-footer">
      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
  <link itemprop="mainEntityOfPage" href="http://chrisrc.me/2015/09/01/autoit-ansible-with-vagrant-and-virtualbox/">

  <span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="chrisrc">
    <meta itemprop="description" content="">
    <meta itemprop="image" content="/images/avatar.gif">
  </span>

  <span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="山中，山外与俯瞰">
    <span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
      <img style="display:none;" itemprop="url image" alt="山中，山外与俯瞰" src="">
    </span>
  </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                
                <a class="post-title-link" href="/2015/09/01/autoit-ansible-with-vagrant-and-virtualbox/" itemprop="url">
                  采用Vagrant搭建Ansible playbook脚本开发测试环境
                </a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2015-09-01T07:24:27+08:00">
                2015-09-01
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/IT自动化/" itemprop="url" rel="index">
                    <span itemprop="name">IT自动化</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <a href="/2015/09/01/autoit-ansible-with-vagrant-and-virtualbox/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2015/09/01/autoit-ansible-with-vagrant-and-virtualbox/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          

          
          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        
          <div class="toc"></div>

<h2 id="前提"><a href="#前提" class="headerlink" title="前提"></a>前提</h2><p>假定下述工具已经安装，本环境基于ubuntu 14.04（<a href="http://www.deepin.org/">deepin</a>）。</p>
<ul>
<li><a href="https://www.vagrantup.com/">Vagrant</a> 1.7.4</li>
<li><a href="https://www.virtualbox.org/">Virtualbox</a> 5.0.2</li>
<li><a href="http://www.ansible.com/">Ansible</a> 1.9.2</li>
<li>编辑器使用<a href="https://github.com/atom/atom">Atom</a></li>
</ul>
          <!--noindex-->
          <div class="post-more-link text-center">
            <a class="btn" href="/2015/09/01/autoit-ansible-with-vagrant-and-virtualbox/#more" rel="contents">
              阅读全文 &raquo;
            </a>
          </div>
          <!--/noindex-->
        
      
    </div>

    <div>
      
    </div>

    <div>
      
    </div>


    <footer class="post-footer">
      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
  <link itemprop="mainEntityOfPage" href="http://chrisrc.me/2015/08/27/autoit-jenkins-jobs-in-eclipse/">

  <span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="chrisrc">
    <meta itemprop="description" content="">
    <meta itemprop="image" content="/images/avatar.gif">
  </span>

  <span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="山中，山外与俯瞰">
    <span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
      <img style="display:none;" itemprop="url image" alt="山中，山外与俯瞰" src="">
    </span>
  </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                
                <a class="post-title-link" href="/2015/08/27/autoit-jenkins-jobs-in-eclipse/" itemprop="url">
                  在Eclipse中管理Jenkins任务
                </a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2015-08-27T11:42:35+08:00">
                2015-08-27
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/IT自动化/" itemprop="url" rel="index">
                    <span itemprop="name">IT自动化</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <a href="/2015/08/27/autoit-jenkins-jobs-in-eclipse/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2015/08/27/autoit-jenkins-jobs-in-eclipse/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          

          
          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        
          <div class="toc"></div>

<h2 id="概述"><a href="#概述" class="headerlink" title="概述"></a>概述</h2><p>IT自动化过程需要由众多的ALM工具支撑，而作为项目开发人员，则希望以一个工具为中心可以完成自动化链条上所有节点的工作。以Eclipse IDE环境为例，<br>开发人员通过Eclipse可以与Git仓库交互，与Jira/Redmine等缺陷跟踪系统交互，与Jenkins集成服务交互，与SonarQube代码审查服务器交互，而不必频繁的切换，影响效率。</p>
          <!--noindex-->
          <div class="post-more-link text-center">
            <a class="btn" href="/2015/08/27/autoit-jenkins-jobs-in-eclipse/#more" rel="contents">
              阅读全文 &raquo;
            </a>
          </div>
          <!--/noindex-->
        
      
    </div>

    <div>
      
    </div>

    <div>
      
    </div>


    <footer class="post-footer">
      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
  <link itemprop="mainEntityOfPage" href="http://chrisrc.me/2015/08/17/autoit-jenkins-notes/">

  <span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="chrisrc">
    <meta itemprop="description" content="">
    <meta itemprop="image" content="/images/avatar.gif">
  </span>

  <span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="山中，山外与俯瞰">
    <span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
      <img style="display:none;" itemprop="url image" alt="山中，山外与俯瞰" src="">
    </span>
  </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                
                <a class="post-title-link" href="/2015/08/17/autoit-jenkins-notes/" itemprop="url">
                  Jenkins环境搭建备注
                </a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2015-08-17T15:21:24+08:00">
                2015-08-17
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/IT自动化/" itemprop="url" rel="index">
                    <span itemprop="name">IT自动化</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <a href="/2015/08/17/autoit-jenkins-notes/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2015/08/17/autoit-jenkins-notes/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          

          
          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <h3 id="安装事项"><a href="#安装事项" class="headerlink" title="安装事项"></a>安装事项</h3><ol>
<li><p>Jenkins数据位置通过JENKINS_HOME环境变量配置。</p>
</li>
<li><p>运行Jenkins的用户/组是：jenkins/jenkins</p>
</li>
<li><p>Jenkins用户jenkins的默认HOME是：/var/lib/jenkins，这与JENKINS_HOME配置的路径是不同的。</p>
</li>
<li><p>在<code>/var/lib/jenkins</code>下构建<code>.ssh</code>目录，存储与SSH 公私钥及主机列表相关；构建<code>.m2</code>目录，用于存储自定义settings.xml配置。</p>
</li>
<li><p>运行 <code>su jenkins -s /bin/bash</code> 进入jenkins用户的shell，调用<code>ssh-keygen</code>命令生成公私钥。</p>
</li>
</ol>
<h3 id="Slave节点配置"><a href="#Slave节点配置" class="headerlink" title="Slave节点配置"></a>Slave节点配置</h3><ol>
<li><p>以SSH方式，Slave节点从Gitlab上获取代码时，应将master节点上jenkins用户下.ssh目录下的id_rsa, id_rsa.pub, known_hosts文件拷贝到Slave节点用户（Jenkins Master以Slave root用户控制slave节点时，放置在root的.ssh目录）的.ssh下。</p>
</li>
<li><p>使用SlaveSetup插件将配置同步到创建的Slave节点。</p>
</li>
</ol>
<h3 id="Jenkins用户安全建设"><a href="#Jenkins用户安全建设" class="headerlink" title="Jenkins用户安全建设"></a>Jenkins用户安全建设</h3><ol>
<li>启用jenkins用户安全登录，选择使用jenkins专有数据库。</li>
<li>选择安全策略，推荐使用基于job的安全策略，此时不要添加用户或租组的权限配置（用户还不存在）。应用后退出。</li>
<li>进入注册页面，第一个注册用户为系统管理员。后续注册的用户需要已存在的用户分配权限。</li>
</ol>
<h3 id="Jenkins-Multijob间传递依赖"><a href="#Jenkins-Multijob间传递依赖" class="headerlink" title="Jenkins Multijob间传递依赖"></a>Jenkins Multijob间传递依赖</h3><ol>
<li>场景：Compile —&gt;  Assembly —-&gt;  Deploy</li>
<li><p>获取<code>POM_VERSION</code>变量，通过“Execute Shell”执行命令：<br>  <code>echo APP_BUILD_VERSION=$POM_VERSION &gt; build.properties</code></p>
<p>  将变量参数保存到<code>$WORSPACE</code>下的文件中；</p>
</li>
<li><p>在下一个JOB中，使用“Inject environment variables”步骤获取上一个JOB中的参数：<br>  <code>$WORKSPACE/../appapi_test_assembly/build.properties</code><br>注意：  </p>
<ul>
<li>这种方式使得后面的JOB对前面JOB的名称产生依赖。</li>
<li>理想方式是使用Parameters Trigger Plugin传递参数（在Multijob方案中未配置成功）</li>
</ul>
</li>
<li><p>前一JOB可以通过“Archive the artifacts”构建后操作存档本次JOB打包的构件；后一JOB可以通过配置“Copy artifacts from another project”将指定JOB的构件输出拷贝到本JOB的WORKSPACE指定目录下。</p>
</li>
</ol>

          
        
      
    </div>

    <div>
      
    </div>

    <div>
      
    </div>


    <footer class="post-footer">
      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
  <link itemprop="mainEntityOfPage" href="http://chrisrc.me/2015/08/15/autoit-jenkins/">

  <span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="chrisrc">
    <meta itemprop="description" content="">
    <meta itemprop="image" content="/images/avatar.gif">
  </span>

  <span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="山中，山外与俯瞰">
    <span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
      <img style="display:none;" itemprop="url image" alt="山中，山外与俯瞰" src="">
    </span>
  </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                
                <a class="post-title-link" href="/2015/08/15/autoit-jenkins/" itemprop="url">
                  IT自动化(6)——生产线上的调度和控制中心Jenkins
                </a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2015-08-15T10:56:19+08:00">
                2015-08-15
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/IT自动化/" itemprop="url" rel="index">
                    <span itemprop="name">IT自动化</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <a href="/2015/08/15/autoit-jenkins/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2015/08/15/autoit-jenkins/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          

          
          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <h2 id="前文回顾"><a href="#前文回顾" class="headerlink" title="前文回顾"></a>前文回顾</h2><p><a href="/2015-08-14/autoit-maven-git-jgit-flow">前文</a>我们将Maven与Gitlab通过<code>jgitflow</code>插件进行衔接，实现了项目的版本自动发布。一个产品的发布有众多的细节<br>需要控制，而版本发布的过程又是一个不断重复的过程。众多的细节，重复的过程和过多的人为参与总是容易出错，这让启动产品发布时，开发团队往往如临大敌，<br>甚至做好通宵达旦的准备。</p>
<p>面对上述问题，开发团队开始意识到这些问题，寻求从中解脱的解决方案。本文将介绍实现IT自动化过程之持续发布、测试、集成、部署的重要<br>支撑工具——<a href="http://jenkins-ci.org/" target="_blank" rel="external">Jenkins</a>。</p>
<h2 id="Jenkins的历史"><a href="#Jenkins的历史" class="headerlink" title="Jenkins的历史"></a>Jenkins的历史</h2><p>Jenkins已经有十多年的历史，最初，Jenkins的前身Hudson是由Sun公司在2004年启动的项目，在2007年左右逐步成为替代 <a href="http://cruisecontrol.sourceforge.net/" target="_blank" rel="external">CruiseControl</a> 和其它开源编译服务器<br>而被大家所熟知。后来，因Oracle对“Hudson”注册商标的问题，开发社区在2011年1月11日开发社区一致决定将Hudson更名为<code>Jenkins</code>。关于Jenkins的介绍请<br>参考wikipedia的<a href="https://en.wikipedia.org/wiki/Jenkins_(software" target="_blank" rel="external">Jenkins (software)</a>)条目。</p>
<p>Jenkins发展到现在，通过其强大的插件体系扩展，已不仅仅是一个用于持续集成的编译服务器，它已经发展成为IT自动化生产线上的调度和控制中心。</p>
<p>类似Jenkins的工具非常多，已广泛应用于不同的开发语言和应用场景，详细信息可参考<a href="https://en.wikipedia.org/wiki/Comparison_of_continuous_integration_software" target="_blank" rel="external">Comparison of continuous integration software</a>。</p>
<h2 id="Jenkins的功能"><a href="#Jenkins的功能" class="headerlink" title="Jenkins的功能"></a>Jenkins的功能</h2><p>Jenkins的功能太过强大，这或许有些崇拜式的夸张，但它至少说明一点，你在面对软件过程中的效率问题时，可以遵循这个原则：第一步先考虑问题的<br>特定解决方案，第二步考虑是否通过Jenkins（或类似Jenkins的工具）更进一步。甚至，你可以将前面说的第二步前置。这也在下图中Jenkins处在<br>整个自动化生产线的中心环节得以确认：</p>
<p><img src="/images/autoit_arch.png" alt="IT自动化架构"></p>
<p>关于Jenkins的基本安装使用，本文不做过多介绍，官方文档及网上有众多资料。另外吐槽一点，众多的Jenkins插件提供了强大的功能的同时，却未能<br>在帮助文档上提供详细的说明，让使用之人在达到目标之前需要不断试错。</p>
<p>Jenkins的设计使用按 <em>系统</em>、<em>任务（Job）</em> 两个层级进行管理。在 <strong>系统</strong> 层级下，用户可以配置 <em>全局参数</em>，<em>插件管理及配置</em>，<em>用户安全及权限</em>，<em>任务运行<br>节点</em> 等；在 <strong>任务</strong> 层级下，用户可以配置具体任务所要达成的目的，包括 <em>任务的全局配置</em>，<em>任务的内部处理环节</em>，<em>任务通过插件与外部系统对接的<br>具体参数</em>，<em>任务与其它任务的关联及触发</em> 等等。</p>
<p>下面我们简要介绍Jenkins的几个关键操作界面。</p>
<h3 id="插件管理"><a href="#插件管理" class="headerlink" title="插件管理"></a>插件管理</h3><p>这是Jenkins应用的起点，用户需要根据自己的应用目的，从Jenkins庞大的插件库中选择适合自己的插件，安装配置。通过“<code>系统管理---&gt;管理插件</code>”进入<br>插件管理界面，选择“<code>可选插件</code>”，可以输入关键字查询过滤插件，也可以通过插件分组进行分类浏览：</p>
<p><img src="/images/autoit_jenkins_plugins_center.png" alt="Jenkins Plugins Center"></p>
<p>通过上图插件分类我们可以看出，Jenkins不仅支持Java语言相关的持续处理，也支持 <strong>android，cloud，database，deployment，devops，dotnet，<br>groovy，ios</strong> 等等相关的持续处理任务。</p>
<h3 id="系统全局配置"><a href="#系统全局配置" class="headerlink" title="系统全局配置"></a>系统全局配置</h3><p>安装完插件后，如果所选插件有独立于特定任务（Job）的配置参数，可以到 <em>系统管理—&gt;系统设置</em> 中进行配置。系统全局配置可以对 <em>全局属性</em>，<br><em>Maven默认配置</em>，<em>多任务处理规则</em>，<em>SSH远程登录</em>，<em>JDK</em>，<em>Git</em>，<em>Gitlab</em>，<em>Maven</em>，<em>Slave节点</em>，<em>SonarQube服务器</em>，<em>Docker配置</em>，<br><em>云配置</em> 等等。</p>
<p><img src="/images/autoit_jenkins_sys_config.png" alt="Jenkins System Config"></p>
<h3 id="用户安全控制"><a href="#用户安全控制" class="headerlink" title="用户安全控制"></a>用户安全控制</h3><p>通过启用用户安全控制策略，可以让不同的人管理不同的任务Job，相互之间不受干扰。Jenkins支持多种不同的安全域和不同的授权策略，可以根据<br>具体场景选择使用。常用的方案是安全域采用“Jenkins专有用户数据库”，授权策略采用“安全矩阵”。通过“<code>系统管理---&gt;Configure Global Security</code>”进入<br>安全管理界面</p>
<p><img src="/images/autoit_jenkins_security_config.png" alt="Jenkins Security Config"></p>
<p><strong>注意：采用“Jenkins专有用户数据库”方案时，应开启用户注册功能，如果不开启注册功能，将无法登录。第一个注册的用户默认为管理员用户</strong></p>
<h3 id="节点管理"><a href="#节点管理" class="headerlink" title="节点管理"></a>节点管理</h3><p>在拥有众多项目团队的开发组织中，集中的Jenkins管理和众多项目的编译需求需要平衡，此时采用<code>Master-Slave</code>解决方案是一个推荐选择。采用Jenkins<br>Master集中管理所有团队的项目，采用安全控制策略授权各自管理，各个项目的持续处理任务（Job）在执行时自动限定在分配给各个团队的专用<br>持续处理服务器上。 Slave节点的管理通过“<code>系统管理---&gt;管理节点</code>”进入配置界面：</p>
<p><img src="/images/autoit_jenkins_slave_node.png" alt="Jenkins Slave Node"></p>
<h3 id="Jenkins的任务（Job）"><a href="#Jenkins的任务（Job）" class="headerlink" title="Jenkins的任务（Job）"></a>Jenkins的任务（Job）</h3><p>Jenkins的任务是我们实现持续处理目标的载体。Jenkins默认支持：</p>
<ul>
<li><p>自由风格的任务<br>这是Jenkins的主要功能.Jenkins将会结合任何SCM和任何构建系统来构建你的项目, 甚至可以构建软件以外的系统。</p>
</li>
<li><p>构建一个Maven项目<br>Jenkins利用项目的POM文件,这样可以大大减轻构建配置的过程。</p>
</li>
<li><p>External Job<br>这个类型的任务允许你记录执行在外部Jenkins的任务, 任务甚至运行在远程机器上。</p>
</li>
<li><p>一个多配置项目<br>   适用于多配置项目,例如多环境测试,平台指定构建,等等。</p>
</li>
<li><p>MultiJob 项目<br>可以在此任务中同时管理多个其他任务（job）的执行。 该任务需要安装Multijob插件。</p>
</li>
</ul>
<p><img src="/images/autoit_jenkins_job_new.png" alt="Jenkins Slave Node"></p>
<h2 id="Jenkins在IT自动化中的作用"><a href="#Jenkins在IT自动化中的作用" class="headerlink" title="Jenkins在IT自动化中的作用"></a>Jenkins在IT自动化中的作用</h2><p>Jenkins的任务（Job）可以实现软件开发过程中的各个处理环节，通过将任务集中控制，自动执行可以实现处理过程的自动化。</p>
<p>在后续篇文章中，我们将借助示例工程，创建项目代码质量审查任务，测试打包任务，测试部署任务，版本发布任务，正式版本打包任务，正式版本<br>部署任务等等。</p>
<h2 id="结论"><a href="#结论" class="headerlink" title="结论"></a>结论</h2><ul>
<li>Jenkins从一个编译服务器发展到软件过程持续处理中心，让我们可以通过它创建特定的任务来调度和管理软件开发过程中的某个环节，并实现任务<br>自动处理，任务间的协同，多任务的流程配置。</li>
</ul>

          
        
      
    </div>

    <div>
      
    </div>

    <div>
      
    </div>


    <footer class="post-footer">
      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
  <link itemprop="mainEntityOfPage" href="http://chrisrc.me/2015/08/14/autoit-maven-git-jgit-flow/">

  <span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="chrisrc">
    <meta itemprop="description" content="">
    <meta itemprop="image" content="/images/avatar.gif">
  </span>

  <span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="山中，山外与俯瞰">
    <span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
      <img style="display:none;" itemprop="url image" alt="山中，山外与俯瞰" src="">
    </span>
  </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                
                <a class="post-title-link" href="/2015/08/14/autoit-maven-git-jgit-flow/" itemprop="url">
                  IT自动化(5)——持续开发中流程管理gitflow
                </a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2015-08-14T10:26:21+08:00">
                2015-08-14
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/IT自动化/" itemprop="url" rel="index">
                    <span itemprop="name">IT自动化</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <a href="/2015/08/14/autoit-maven-git-jgit-flow/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2015/08/14/autoit-maven-git-jgit-flow/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          

          
          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <h2 id="前文回顾"><a href="#前文回顾" class="headerlink" title="前文回顾"></a>前文回顾</h2><p><a href="/2015-08-13/autoit-gitlab">前文</a>讲述了IT自动化生产线上的核心工具开源Git服务器实现Gitlab。本文将以前述两篇文章为基础，以代码工程示例，将Maven和Gitlab进行整合，实现生产线上<br>的第一次自动化衔接。</p>
<h2 id="Git-Flow"><a href="#Git-Flow" class="headerlink" title="Git-Flow"></a>Git-Flow</h2><p>在实际示例之前，我们先回顾一下著名的Git-Flow模型。该模型来自<a href="http://nvie.com/posts/a-successful-git-branching-model/" target="_blank" rel="external">Vincent Driessen’s branching model</a></p>
<p><img src="/images/autoit_gitflow.gif" alt="Git-Flow"></p>
<p>Git-Flow模型是一个动态可伸缩的模型，你可以根据项目的复杂度灵活的缩减或增加流程。其中，最基本最简单的流程是就是develop和master，分别对应着<br>开发和发布两个过程。</p>
<p>关于Git-Flow的详细指南，请参考<a href="http://blog.jobbole.com/76867/" target="_blank" rel="external">Git工作流指南：Gitflow工作流</a>。</p>
<h2 id="jgit-flow"><a href="#jgit-flow" class="headerlink" title="jgit-flow"></a>jgit-flow</h2><p>在基于Maven管理的项目中，<code>maven-release-plugin</code>能够满足通常的项目发布过程，但是 <strong>maven-release-plugin</strong> 最初用在基于CVS/SVN的发布过程，为了<br>向后兼容，该插件很难满足基于Git-Flow模型的发布管理。</p>
<p>Atlassian公司开源了<a href="https://bitbucket.org/atlassian/jgit-flow" target="_blank" rel="external">Maven JGit-Flow Plugin</a>，该插件基于<a href="http://eclipse.org/jgit/" target="_blank" rel="external">JGit</a>实现了<br>Vincent Driessen的<code>branching model</code>。</p>
<h3 id="jgit-flow的功能"><a href="#jgit-flow的功能" class="headerlink" title="jgit-flow的功能"></a>jgit-flow的功能</h3><ul>
<li><a href="https://bitbucket.org/atlassian/jgit-flow/wiki/goals/release-start" target="_blank" rel="external">release-start</a> - 创建一个<em>发布分支</em>，使用<em>发布版本号</em>更新工程中的POM版本  </li>
<li><a href="https://bitbucket.org/atlassian/jgit-flow/wiki/goals/release-finish" target="_blank" rel="external">release-finish</a> - 执行一次Maven编译（deploy或install），合并release-start过程中创建的发布分支，使用<em>开发版本号</em>更新工程中的POM版本  </li>
<li><a href="https://bitbucket.org/atlassian/jgit-flow/wiki/goals/hotfix-start" target="_blank" rel="external">hotfix-start</a> - 创建一个<em>补丁分支</em>，使用<em>补丁版本号</em>更新工程中的POM版本</li>
<li><a href="https://bitbucket.org/atlassian/jgit-flow/wiki/goals/hotfix-finish" target="_blank" rel="external">hotfix-finish</a> - 执行一次Maven编译（deploy或install），合并hotfix-start过程中创建的补丁分支，使用<em>之前的版本号</em>更新工程中的POM版本  </li>
<li><a href="https://bitbucket.org/atlassian/jgit-flow/wiki/goals/feature-start" target="_blank" rel="external">feature-start</a> - 创建一个<em>功能分支</em></li>
<li><a href="https://bitbucket.org/atlassian/jgit-flow/wiki/goals/feature-finish" target="_blank" rel="external">feature-finish</a> - 合并一个<em>功能分支</em></li>
<li><a href="https://bitbucket.org/atlassian/jgit-flow/wiki/goals/build-number" target="_blank" rel="external">build-number</a> - 通过添加一个编译编号（-buildX， X通过<code>buildNumber</code>属性来指定）来更新当前分支中的POM版本</li>
</ul>
<h3 id="使用jgit-flow"><a href="#使用jgit-flow" class="headerlink" title="使用jgit-flow"></a>使用jgit-flow</h3><p>通过在pom.xml中添加如下配置来使用jgit-flow：  </p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">build</span>&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">plugins</span>&gt;</span></div><div class="line">        <span class="tag">&lt;<span class="name">plugin</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>external.atlassian.jgitflow<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>jgitflow-maven-plugin<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">version</span>&gt;</span>1.0-m5.1<span class="tag">&lt;/<span class="name">version</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">configuration</span>&gt;</span></div><div class="line">               <span class="tag">&lt;<span class="name">flowInitContext</span>&gt;</span></div><div class="line">                 <span class="tag">&lt;<span class="name">masterBranchName</span>&gt;</span>frankenstein<span class="tag">&lt;/<span class="name">masterBranchName</span>&gt;</span></div><div class="line">                 <span class="tag">&lt;<span class="name">developBranchName</span>&gt;</span>development<span class="tag">&lt;/<span class="name">developBranchName</span>&gt;</span></div><div class="line">                 <span class="tag">&lt;<span class="name">featureBranchPrefix</span>&gt;</span>feature-<span class="tag">&lt;/<span class="name">featureBranchPrefix</span>&gt;</span></div><div class="line">                 <span class="tag">&lt;<span class="name">releaseBranchPrefix</span>&gt;</span>release-<span class="tag">&lt;/<span class="name">releaseBranchPrefix</span>&gt;</span></div><div class="line">                 <span class="tag">&lt;<span class="name">hotfixBranchPrefix</span>&gt;</span>hotfix-<span class="tag">&lt;/<span class="name">hotfixBranchPrefix</span>&gt;</span></div><div class="line">                 <span class="tag">&lt;<span class="name">versionTagPrefix</span>&gt;</span>blither-<span class="tag">&lt;/<span class="name">versionTagPrefix</span>&gt;</span></div><div class="line">               <span class="tag">&lt;/<span class="name">flowInitContext</span>&gt;</span></div><div class="line">               <span class="tag">&lt;<span class="name">username</span>&gt;</span>MY_USER<span class="tag">&lt;/<span class="name">username</span>&gt;</span></div><div class="line">               <span class="tag">&lt;<span class="name">password</span>&gt;</span>MY_PW<span class="tag">&lt;/<span class="name">password</span>&gt;</span></div><div class="line">            <span class="tag">&lt;/<span class="name">configuration</span>&gt;</span></div><div class="line">        <span class="tag">&lt;/<span class="name">plugin</span>&gt;</span></div><div class="line">    <span class="tag">&lt;/<span class="name">plugins</span>&gt;</span></div><div class="line"><span class="tag">&lt;/<span class="name">build</span>&gt;</span></div></pre></td></tr></table></figure>
<p>常用配置参数如下表所示，更详细的配置请参考上述jgit-flow的goals。  </p>
<table>
<thead>
<tr>
<th>参数</th>
<th>注释</th>
</tr>
</thead>
<tbody>
<tr>
<td>allowSnapshots</td>
<td>是否允许SNAPSHOT依赖，默认值为false</td>
</tr>
<tr>
<td>autoVersionSubmodules</td>
<td>是否允许为子模块自动设定父模块的版本，默认值为false，执行时会逐个模块提示</td>
</tr>
<tr>
<td>pushReleases</td>
<td>是否将发布分支推送到远端服务器，默认值为false</td>
</tr>
<tr>
<td>keepBranch</td>
<td>是否在发布完成后还保留发布分支，如果值为false将删除分支，默认值为false</td>
</tr>
<tr>
<td>noDeploy</td>
<td>是否执行maven deploy，默认值为false，设为true时，执行maven的install目标</td>
</tr>
</tbody>
</table>
<h2 id="版本发布示例"><a href="#版本发布示例" class="headerlink" title="版本发布示例"></a>版本发布示例</h2><p>下面我们以<a href="https://github.com/christtrc/greeter-osgi-example" target="_blank" rel="external">greeter-osgi-example</a>代码工程来演示基于Maven管理的项目采用Git-Flow发布版本到Gitlab上的过程。</p>
<h3 id="示例工程"><a href="#示例工程" class="headerlink" title="示例工程"></a>示例工程</h3><p>关于本文示例工程的详细介绍，请参考前述博文 <strong>Apache Karaf构建动态模块化应用</strong> 系列。示例工程中的<code>jgit-flow</code>插件配置如下所示：<br><figure class="highlight xml"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">plugin</span>&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>external.atlassian.jgitflow<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>jgitflow-maven-plugin<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">version</span>&gt;</span>1.0-m5.1<span class="tag">&lt;/<span class="name">version</span>&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">configuration</span>&gt;</span></div><div class="line">        <span class="tag">&lt;<span class="name">autoVersionSubmodules</span>&gt;</span>true<span class="tag">&lt;/<span class="name">autoVersionSubmodules</span>&gt;</span></div><div class="line">        <span class="tag">&lt;<span class="name">pushReleases</span>&gt;</span>true<span class="tag">&lt;/<span class="name">pushReleases</span>&gt;</span></div><div class="line">        <span class="tag">&lt;<span class="name">keepBranch</span>&gt;</span>false<span class="tag">&lt;/<span class="name">keepBranch</span>&gt;</span></div><div class="line">        <span class="tag">&lt;<span class="name">noDeploy</span>&gt;</span>true<span class="tag">&lt;/<span class="name">noDeploy</span>&gt;</span></div><div class="line">        <span class="tag">&lt;<span class="name">flowInitContext</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">developBranchName</span>&gt;</span>dev<span class="tag">&lt;/<span class="name">developBranchName</span>&gt;</span></div><div class="line">            <span class="tag">&lt;<span class="name">versionTagPrefix</span>&gt;</span>release/<span class="tag">&lt;/<span class="name">versionTagPrefix</span>&gt;</span></div><div class="line">        <span class="tag">&lt;/<span class="name">flowInitContext</span>&gt;</span></div><div class="line">    <span class="tag">&lt;/<span class="name">configuration</span>&gt;</span></div><div class="line"><span class="tag">&lt;/<span class="name">plugin</span>&gt;</span></div></pre></td></tr></table></figure></p>
<p>在上述配置中，我们通过<code>autoVersionSubmodules</code>配置在发布时仅需确认一次版本号，通过<code>pushReleases</code>将发布分支推送到Gitlab，<br>通过<code>keepBranch</code>在发布完成后删除分支标记，通过<code>noDeploy</code>取消执行<code>release-finish</code>目标过程中同时向远端Nexus仓库部署发布的构件（因为<br>本工程为示例工程，所以简化了此步骤。在实际开发过程中，推荐将发布构件上传到Nexus仓库，供其它项目使用）。</p>
<h3 id="开发流程"><a href="#开发流程" class="headerlink" title="开发流程"></a>开发流程</h3><p><strong>首先</strong> 创建Git仓库，准备工程初始环境，提交到Git仓库作为master基线。如下图所示：</p>
<p><img src="/images/autoit_gitflow_project_dev.png" alt="jgitflow:project dev"></p>
<p>冻结master分支（Project—Settings—-Protected Branches），仅将权限分配给负责发布的人员。</p>
<p>创建<code>dev</code>分支，团队所有人员的开发工作围绕此分支进行。为了产品的快速开发迭代，测试工作可以在<code>dev</code>分支上进行，具体请参考<br>后续文章中通过Jenkins与Gitlab集成并自动触发测试版本的构建的介绍。当前我们关注正式版本的发布流程。</p>
<p><img src="/images/autoit_gitflow_release_pre.png" alt="jgitflow:project merge"></p>
<p>待开发工作进行到一定阶段，可以发布一个版本时，将<code>dev</code>分支合并到master分支。这一步工作既可以在命令行，也可以通过客户端工具，最<br>方便的是Gitlab直接提供了<code>merge request</code>功能：</p>
<p><img src="/images/autoit_gitflow_release_pre2.png" alt="jgitflow:project merge"></p>
<p><img src="/images/autoit_gitflow_release_pre3.png" alt="jgitflow:project merge"></p>
<p><img src="/images/autoit_gitflow_release_pre4.png" alt="jgitflow:project merge"></p>
<p>通过<code>Accept Merge Request</code>，合并<code>dev</code>分支到<code>master</code>分支，发布工作准备就绪。</p>
<h3 id="Start-Release"><a href="#Start-Release" class="headerlink" title="Start Release"></a>Start Release</h3><p>克隆一个最新的版本（<strong>推荐</strong>），否则，<strong>在执行下述命令前，请将本地工程提交并push到远程Gitlab服务器，并同步代码到本地</strong>，进入到工程目录，<br>在命令行执行如下命令：  </p>
<blockquote>
<p><code>mvn jgitflow:release-start</code></p>
</blockquote>
<p>如果工程准备就绪，jgitflow会分析工程结构，确认当前开发版本号，并提示用户确认要正式发布的版本号，如下图所示：</p>
<p><img src="/images/autoit_gitflow_release_start.png" alt="jgitflow:release-start"></p>
<p>在确认发布版本号之后，jgitflow会自动在发布版本号的基础上加1，作为下一个开发版本号。继续确认，jgitflow将提示输入访问Gitlab服务器<br>的用户凭据（可以在Plugin配置参数里设定）。输入凭据后，release-start的过程结束。</p>
<p><img src="/images/autoit_gitflow_release_start_2.png" alt="jgitflow:release-start"></p>
<p>此时，本地和远端Gitlab均创建一个名为<code>release/1.0.0</code>的分支，远端是否创建可通过配置参数控制。</p>
<p><img src="/images/autoit_gitflow_release_start_3.png" alt="jgitflow:release-start"></p>
<h3 id="Finish-Release"><a href="#Finish-Release" class="headerlink" title="Finish Release"></a>Finish Release</h3><p>在<code>release-start</code>目标成功执行后，可以启动<code>release-finish</code>来完成最终的版本发布。首先在工程目录中，执行如下命令：  </p>
<blockquote>
<p><code>mvn jgitflow:release-finish</code></p>
</blockquote>
<p><img src="/images/autoit_gitflow_release_finish.png" alt="jgitflow:release-finish"></p>
<p>待命令成功执行后，版本发布完成。我们可以登录到Gitlab上查看发布版本后生成的新的标记Tag（<code>release/1.0.0</code>）:  </p>
<p><img src="/images/autoit_gitflow_release_finish2.png" alt="jgitflow:release-finish"></p>
<h2 id="自动化是如何实现的"><a href="#自动化是如何实现的" class="headerlink" title="自动化是如何实现的"></a>自动化是如何实现的</h2><p>在上述操作过程中，我们简要分了三个阶段，即 <strong>日常开发阶段</strong>， <strong>分支合并阶段</strong> 和 最终的 <strong>发布阶段</strong>。</p>
<p>日常开发阶段是开发团队<br>的日常工作，也是我们IT自动化过程中工作的起点， 分支合并阶段是有项目管理人员控制的，实际上也是日常开发的一部分， 发布阶段，我们<br>通过两个maven命令就完成了项目的版本发布。</p>
<p>此处的发布仍然是手工操作，在后续讲到Jenkins时，我们通过与Jenkins集成，来实现版本的自动发布。</p>
<h2 id="结论"><a href="#结论" class="headerlink" title="结论"></a>结论</h2><ul>
<li>Maven为工程的自动化构建提供了支撑， Gitlab实现了源代码及版本管理，<code>jgitflow</code>插件将两者结合起来，使得工作过程得以自动<br>衔接。</li>
<li>在下一篇文章中，我们将开始介绍自动化构建过程中的另一个最重要的工具——Jenkins。</li>
</ul>

          
        
      
    </div>

    <div>
      
    </div>

    <div>
      
    </div>


    <footer class="post-footer">
      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
  <link itemprop="mainEntityOfPage" href="http://chrisrc.me/2015/08/13/autoit-gitlab/">

  <span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="chrisrc">
    <meta itemprop="description" content="">
    <meta itemprop="image" content="/images/avatar.gif">
  </span>

  <span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="山中，山外与俯瞰">
    <span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
      <img style="display:none;" itemprop="url image" alt="山中，山外与俯瞰" src="">
    </span>
  </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                
                <a class="post-title-link" href="/2015/08/13/autoit-gitlab/" itemprop="url">
                  IT自动化(4)——持续开发的代码管理中心Gitlab
                </a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2015-08-13T19:24:27+08:00">
                2015-08-13
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/IT自动化/" itemprop="url" rel="index">
                    <span itemprop="name">IT自动化</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <a href="/2015/08/13/autoit-gitlab/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2015/08/13/autoit-gitlab/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          

          
          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <h2 id="前文回顾"><a href="#前文回顾" class="headerlink" title="前文回顾"></a>前文回顾</h2><p><a href="/2015-08-12/autoit-maven-nexus">前文</a>我们讲述了基于maven/nexus的自动化构建工具，这是我们实现IT自动化的起点也是一个基石。<br>构建IT自动化的另一个基石是开发人员紧密协作的中心—源代码跟踪管理的工具SCM，这里选择Gitlab。</p>
<h2 id="Gitlab"><a href="#Gitlab" class="headerlink" title="Gitlab"></a>Gitlab</h2><p><a href="https://about.gitlab.com/" target="_blank" rel="external">Gitlab</a>是一个功能类似于github，用来管理项目源代码的git服务器产品。Gitlab的核心功能是为开发团队提供项目、人员、分组、角色及权限的粒度化控制。通过<br>Gitlab可以方便的管理分支（branch），标记（tag），提交Pull request，处理merge request。可以方便的查询提交历史，比较提交差异，查看人员提交统计结果。<br>Gitlab在提供Git源代码管理功能的同时，也提供了问题跟踪和简易Wiki功能。</p>
<p>为了能够让Gitlab成为一个开发团队的协同工作中心，Gitlab通过<a href="http://doc.gitlab.com/ce/web_hooks/web_hooks.html" target="_blank" rel="external">Web hooks</a>向其它应用监听方通知项目<br>的提交、标记、注释、问题变更及合并请求，由监听方进行处理。Gitlab还提供与诸如团队协同工具Asana，项目管理工具Assembla/JIRA/Redmine，持续集成工具Gitlab CI，<br>即时消息工具HipChat等进行集成的<a href="http://doc.gitlab.com/ce/project_services/project_services.html" target="_blank" rel="external">服务</a>。</p>
<p>对于Gitlab的详细功能请查看<a href="https://about.gitlab.com/features/" target="_blank" rel="external">官方功能列表</a>，对于Gitlab的详细帮助请查看<a href="http://doc.gitlab.com/ce/" target="_blank" rel="external">官方文档</a><br>或者搜索网上的介绍。</p>
<h2 id="Git概述"><a href="#Git概述" class="headerlink" title="Git概述"></a>Git概述</h2><p><a href="http://git-scm.com/" target="_blank" rel="external">Git</a>作为一个分布式版本控制系统，相关的资料书籍非常多，这里仅做简要概述。</p>
<p><strong>首先</strong>，从设计模型对比可以清晰的理解传统SCM（SVN/CVS等）与Git的差异：<br><img src="/images/autoit_git_arch_svn.png" width="322" height="248" alt="SVN Arch" align="center"><br><img src="/images/autoit_git_arch_git.png" width="322" height="248" alt="SVN Arch" align="center"></p>
<p><strong>其次</strong>，Git与SVN/CVS的另一个重要差别是对资源变更的跟踪机制。Git跟踪的资源称之为<code>blob</code>，<strong>blob</strong> 是版本受控的文件，在整个系统中，某次跟踪(<code>commit</code>)的文件，<br>不管后续有多少次<em>commit</em>，创建了多少个<em>branch</em>，标记了多少个<em>tag</em>，这个文件blob是唯一的。<br><img src="/images/autoit_git_blob_model.png" alt="Git Object Model"></p>
<p><strong>最后</strong>，正是因为Git精炼的资源跟踪机制，使得基于Branch的开发不再是一个高空间耗用和低效率的模式，也使得基于分支的开发成为以Git为中心的推荐工作流程。下面的<br>动态图可以很好的展示的Git分支开发的特征：  </p>
<p><img src="/images/autoit_git_branchs.gif" alt="Git Branch Illustrated"></p>
<p>基于Git分支的开发，<code>master</code>分支可以作为正式发布分支（具体实践可自定义控制），<code>develop</code>分支可以作为开发分支，其他的分支可以作为<code>feature</code>分支随时添加<br>进来，并在 <strong>Feature</strong> 功能开发完成后合并到 <strong>develop</strong> 分支。 <strong>develop</strong> 分支（也可以单建测试分支）通过单元测试，内部集成测试后<br>合并到 <strong>master</strong> 分支用于版本发布。下图动态展示了基于分支的工作流程及<em>Merge Flow</em>和<em>Rebase Flow</em>的差异。  </p>
<p><img src="/images/autoit_git_branchs_dev.gif" alt="Git Branch Illustrated"></p>
<h2 id="Gitlab在IT自动化中的作用"><a href="#Gitlab在IT自动化中的作用" class="headerlink" title="Gitlab在IT自动化中的作用"></a>Gitlab在IT自动化中的作用</h2><p>用在开发过程中的工具，最主要的作用就是协同和提高效率。Gitlab为基于git flow的工作流程提供了强大的功能支持，其开放的接口又使得其很容易与其他工具<br>进行集成，从而可以构建自动化的工作流程。</p>
<p>关于Gitlab在自动化流程中的效用，我们会在后续文章中以实际示例进行说明。</p>
<h2 id="结论"><a href="#结论" class="headerlink" title="结论"></a>结论</h2><ul>
<li>Gitlab以其强大的功能，每月一个版本的迭代速度，及其与Github相似的功能风格，推荐选择开源Git服务器的团队使用。</li>
<li>前文讲述了本地工程自动化构建工具Maven，本文讲述了分布式版本控制系统Gitlab，到目前为止，团队协同的代码工程管理中心和代码工程自动化构建的工具<br>都已经齐备，在下一篇文章中，我会将这两者结合起来，实现自动化的产品构建和版本发布。</li>
<li><strong>备注:</strong> 本文中与Git相关的图形来自<a href="mgroves@microsoft.com">Mark Groves</a>的PPT文档: <strong>Introducing Git version control into your team</strong></li>
</ul>
<h2 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h2><ul>
<li><a href="http://book.douban.com/subject/6526452/" target="_blank" rel="external">Git权威指南</a></li>
</ul>

          
        
      
    </div>

    <div>
      
    </div>

    <div>
      
    </div>


    <footer class="post-footer">
      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
  <link itemprop="mainEntityOfPage" href="http://chrisrc.me/2015/08/12/autoit-gitlab-git/">

  <span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="chrisrc">
    <meta itemprop="description" content="">
    <meta itemprop="image" content="/images/avatar.gif">
  </span>

  <span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="山中，山外与俯瞰">
    <span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
      <img style="display:none;" itemprop="url image" alt="山中，山外与俯瞰" src="">
    </span>
  </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                
                <a class="post-title-link" href="/2015/08/12/autoit-gitlab-git/" itemprop="url">
                  Git常用操作指令注记
                </a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2015-08-12T16:34:15+08:00">
                2015-08-12
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/IT自动化/" itemprop="url" rel="index">
                    <span itemprop="name">IT自动化</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <a href="/2015/08/12/autoit-gitlab-git/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2015/08/12/autoit-gitlab-git/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          

          
          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <div class="toc"></div>

<h3 id="SVN向Git迁移"><a href="#SVN向Git迁移" class="headerlink" title="SVN向Git迁移"></a>SVN向Git迁移</h3><h4 id="问题描述"><a href="#问题描述" class="headerlink" title="问题描述"></a>问题描述</h4><p>从SVN向Git迁移，版本历史保留及项目多模块的拆分是一个很大的障碍。git svn命令为此提供了很好的方案。</p>
<p>####解决方案</p>
<ol>
<li><p>首先，为SVN用户与Git用户建立映射关系。通过下面的命令获取SVN项目中用户信息，并输出到users.txt文件  </p>
<blockquote>
<p>java -jar ./svn-migration-scripts.jar authors svn://192.168.1.5/foo &gt; users.txt<br>该命令使用<a href="https://bitbucket.org/atlassian/svn-migration-scripts/downloads/svn-migration-scripts.jar" target="_blank" rel="external">svn-migration-scripts.jar</a></p>
</blockquote>
</li>
<li><p>调整users.txt内容，使之复合git的要求：  </p>
<blockquote>
<p>zzm  zhanghaiming &lt;zhanghaiming@xxx.com&gt;</p>
</blockquote>
</li>
<li><p>克隆SVN项目，同时转换为Git项目（注意：如果SVN项目不是标准的trunk/branch结构，需要在参数中指定trunk/branch的具体路径）：  </p>
<blockquote>
<p>git svn clone –trunk=/ –authors-file=users.txt svn://192.168.1.5/foo foo-git-repo</p>
</blockquote>
</li>
<li><p>SVN工程往往包含众多的项目资源，需要将这些资源拆分为多个Git仓库，此时，可以以步骤3中的.git历史库为基线，新的代码仅根据各个仓库的需要保留资源，<br>同时又可以保留跟踪历史。</p>
</li>
</ol>
<h3 id="本地Git仓库同时指向多个远端Git仓库"><a href="#本地Git仓库同时指向多个远端Git仓库" class="headerlink" title="本地Git仓库同时指向多个远端Git仓库"></a>本地Git仓库同时指向多个远端Git仓库</h3><h4 id="问题描述-1"><a href="#问题描述-1" class="headerlink" title="问题描述"></a>问题描述</h4><p>有的时候，我们从一个开源仓库如Github上克隆一个项目，根据需要进行裁剪修改，用在我们自己的项目中，并Push到我们内部的Git服务器。<br>随着时间的推移，位于Github上的项目进行了更新，而我们希望跟踪合并这些更新，但同时，本地的工作版本已经积累了大量的内部变更，<br>采用手动合并的方式不仅耗时，耗力而且准确性很难保证。</p>
<h4 id="解决方案"><a href="#解决方案" class="headerlink" title="解决方案"></a>解决方案</h4><p>假定项目来自Github: <a href="https://github.com/foo/bar.git" target="_blank" rel="external">https://github.com/foo/bar.git</a></p>
<p>Git支持同一仓库多个远端的方案。具体操作步骤如下：</p>
<ol>
<li><p>首先，将bar项目克隆到本地, 此时，默认的git origin指向github：  </p>
<blockquote>
<p>git clone <a href="https://github.com/foo/bar.git" target="_blank" rel="external">https://github.com/foo/bar.git</a>  </p>
</blockquote>
</li>
<li><p>假定内部项目Git服务器位于<a href="http://127.0.0.1，" target="_blank" rel="external">http://127.0.0.1，</a> 为克隆到本的bar项目添加新的远端（这里命名为local）指向127.0.0.1 Git服务器：  </p>
<blockquote>
<p>git remote add [local] <a href="http://127.0.0.1/oss/bar.git" target="_blank" rel="external">http://127.0.0.1/oss/bar.git</a></p>
</blockquote>
</li>
<li><p>切换本地项目到新的分支上  </p>
<blockquote>
<p>git checkout -b local local/master</p>
</blockquote>
</li>
<li><p>在此分支上进行代码修改，在Push时，将代码Push到内部Git服务器。  </p>
<blockquote>
<p>git push local master</p>
</blockquote>
</li>
<li><p>在此分支上合并Github上项目的最新变更  </p>
<blockquote>
<p>git merge origin/master</p>
</blockquote>
</li>
</ol>

          
        
      
    </div>

    <div>
      
    </div>

    <div>
      
    </div>


    <footer class="post-footer">
      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </article>


    
  </section>

  
  <nav class="pagination">
    <a class="extend prev" rel="prev" href="/page/4/"><i class="fa fa-angle-left"></i></a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/4/">4</a><span class="page-number current">5</span><a class="page-number" href="/page/6/">6</a><a class="page-number" href="/page/7/">7</a><a class="extend next" rel="next" href="/page/6/"><i class="fa fa-angle-right"></i></a>
  </nav>



          </div>
          


          

        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      

      <section class="site-overview sidebar-panel sidebar-panel-active">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/avatar.gif"
               alt="chrisrc" />
          <p class="site-author-name" itemprop="name">chrisrc</p>
          <p class="site-description motion-element" itemprop="description"></p>
        </div>
        <nav class="site-state motion-element">
          <div class="site-state-item site-state-posts">
            <a href="/archives">
              <span class="site-state-item-count">69</span>
              <span class="site-state-item-name">日志</span>
            </a>
          </div>

          
            <div class="site-state-item site-state-categories">
              <a href="/categories">
                <span class="site-state-item-count">21</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            <div class="site-state-item site-state-tags">
              <a href="/tags">
                <span class="site-state-item-count">162</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/christtrc" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://twitter.com/chrisrc" target="_blank" title="Twitter">
                  
                    <i class="fa fa-fw fa-twitter"></i>
                  
                  Twitter
                </a>
              </span>
            
          
        </div>

        
        
          <div class="cc-license motion-element" itemprop="license">
            <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" class="cc-opacity" target="_blank">
              <img src="/images/cc-by-nc-sa.svg" alt="Creative Commons" />
            </a>
          </div>
        

        
        

        


      </section>

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy;  2015 - 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">
     
      <a href="mailto:chrisrc@qq.com">chrisrc</a> 
    
  </span>
  <span class="author"> &nbsp; QQ: 58122705 </span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Mist
  </a>
</div>


        

        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  



  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  

  

  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  

  
    
  

  <script type="text/javascript">
    var duoshuoQuery = {short_name:"chrisrc"};
    (function() {
      var ds = document.createElement('script');
      ds.type = 'text/javascript';ds.async = true;
      ds.id = 'duoshuo-script';
      ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
      ds.charset = 'UTF-8';
      (document.getElementsByTagName('head')[0]
      || document.getElementsByTagName('body')[0]).appendChild(ds);
    })();
  </script>

  
    
    
    <script src="/lib/ua-parser-js/dist/ua-parser.min.js?v=0.7.9"></script>
    <script src="/js/src/hook-duoshuo.js"></script>
  








  
  

  

  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  
<script>
(function(){
   var src = (document.location.protocol == "http:") ? "http://js.passport.qihucdn.com/11.0.1.js?ed903ab05fbc5fa64d95e4bfbf3d3a04":"https://jspassport.ssl.qhimg.com/11.0.1.js?ed903ab05fbc5fa64d95e4bfbf3d3a04";
   document.write('<script src="' + src + '" id="sozz"><\/script>');
})();
</script>

  


</body>
</html>
